Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove kube-rbac-proxy #8302

Merged
merged 15 commits into from
Dec 11, 2024
Merged

Remove kube-rbac-proxy #8302

merged 15 commits into from
Dec 11, 2024

Conversation

pebrc
Copy link
Collaborator

@pebrc pebrc commented Dec 6, 2024

Fixes #8279

This removes the kube-auth-proxy from the ECK Helm charts and the ECK documentation. Instead if follows the recommendation from controller-runtime to use the built-in FilterProvider filters.WithAuthenticationAndAuthorization.

This pulls in a bunch of k8s API server dependencies increasing the binary size by about 12MB IIRC.

I have also tried to address some issues with our current Helm templating of the metrics server:

  • allow enabling the secure mode with TLS+auth while not forcing users to have Promotheus installed e.g. when using Elastic Agent (!) (service monitor is still generated by default for bwc)
  • mixing configuration properties for the service monitor with the configuration properties of the metrics server (I moved them to serviceMonitor.* while implementing a form of bwc layer in the template

Things I did not address:

  • the mutual exclusion between secure metrics and the pod monitor (see my comment below)

Tests I did (all with Prometheus operator):

  • Helm installation with auto-gen self-signed certs insecureSkipVerify: true
  • Manual installation with auto-gen self-signed certs insecureSkipVerify: true
  • Manual installation with cert-manager certs + modified Prometheus deployment and insecureSkipVerify: false

Review
If you can test a few scenarios while reviewing this it would much appreciated to flush out any issues I have missed.

@botelastic botelastic bot added the triage label Dec 6, 2024
@pebrc pebrc added the >enhancement Enhancement of existing functionality label Dec 6, 2024
@botelastic botelastic bot removed the triage label Dec 6, 2024
@pebrc pebrc marked this pull request as ready for review December 9, 2024 15:50
@naemono
Copy link
Contributor

naemono commented Dec 9, 2024

I'll look at this today @pebrc

@naemono
Copy link
Contributor

naemono commented Dec 10, 2024

I'll look at this today @pebrc

When testing with the following values

config:
  metrics:
    port: 8443
    secureMode:
      enabled: true
image:
  repository: docker.elastic.co/eck-ci/eck-operator-pr
  tag: 8302-b2670646
installCRDs: true
managedNamespaces: []
webhook:
  enabled: true

I see this working without issues:
image

I'll have to test with more scenarios tomorrow and update.

@naemono
Copy link
Contributor

naemono commented Dec 10, 2024

From my testing the option for providing your own certificate/key/ca is broken, as it was configured in the rbac-proxy in the previous implementation. I'm working through what the fix looks like for this and will update.

Signed-off-by: Michael Montgomery <mmontg1@gmail.com>
@naemono
Copy link
Contributor

naemono commented Dec 10, 2024

From my testing the option for providing your own certificate/key/ca is broken, as it was configured in the rbac-proxy in the previous implementation. I'm working through what the fix looks like for this and will update.

I've pushed a commit that fixes the issue when using custom certificates:
image

Using the following values:

config:
  metrics:
    port: 8443
    secureMode:
      enabled: true
      tls:
        certificateSecret: eck-metrics-tls-certificate
image:
  repository: docker.elastic.co/eck-ci/eck-operator-pr
  tag: 8302-b2670646
installCRDs: true
managedNamespaces: []
podMonitor:
  enabled: false
serviceMonitor:
  caSecret: eck-metrics-tls-ca
  enabled: true
  insecureSkipVerify: false
webhook:
  enabled: true

@pebrc
Copy link
Collaborator Author

pebrc commented Dec 10, 2024

From my testing the option for providing your own certificate/key/ca is broken, as it was configured in the rbac-proxy in the previous implementation. I'm working through what the fix looks like for this and will update.

I've pushed a commit that fixes the issue when using custom certificates: image

Using the following values:

config:
  metrics:
    port: 8443
    secureMode:
      enabled: true
      tls:
        certificateSecret: eck-metrics-tls-certificate
image:
  repository: docker.elastic.co/eck-ci/eck-operator-pr
  tag: 8302-b2670646
installCRDs: true
managedNamespaces: []
podMonitor:
  enabled: false
serviceMonitor:
  caSecret: eck-metrics-tls-ca
  enabled: true
  insecureSkipVerify: false
webhook:
  enabled: true

Good catch. I tested the custom certs only with the manual mode. I think there is a simpler fix though by just using the default path from controller-runtime in the volume mount.

@naemono
Copy link
Contributor

naemono commented Dec 10, 2024

Good catch. I tested the custom certs only with the manual mode. I think there is a simpler fix though by just using the default path from controller-runtime in the volume mount.

I'll take a look at this and update... thanks

@naemono
Copy link
Contributor

naemono commented Dec 11, 2024

Good catch. I tested the custom certs only with the manual mode. I think there is a simpler fix though by just using the default path from controller-runtime in the volume mount.

I'll take a look at this and update... thanks

i sat down to finish this and saw you handled it. i will verify in the am. thanks

cmd/manager/main.go Outdated Show resolved Hide resolved
Copy link
Contributor

@barkbay barkbay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! I really like the additional fixes/improvements you included in this PR 👍

I ran a couple of tests, only with Helm, using both the ECK and the Prometheus operator charts, with a custom CA, enforcing (or not) TLS validation, and it worked as expected.

docs/operating-eck/configure-operator-metrics.asciidoc Outdated Show resolved Hide resolved
@pebrc pebrc added the v2.16.0 label Dec 11, 2024
Copy link
Contributor

@thbkrkr thbkrkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

cmd/manager/main.go Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not from your PR, I noticed the metadata.labels of the Service and the spec.selector.matchLabels of the ServiceMonitor in configure-operator-metrics.asciidoc are not aligned with what is rendered using the Helm chart.

@pebrc pebrc merged commit 032bff5 into elastic:main Dec 11, 2024
5 checks passed
pebrc added a commit to pebrc/cloud-on-k8s that referenced this pull request Dec 11, 2024
This removes the kube-auth-proxy from the ECK Helm charts and the ECK documentation. Instead if follows the recommendation from controller-runtime to use the built-in FilterProvider filters.WithAuthenticationAndAuthorization.

This pulls in a bunch of k8s API server dependencies increasing the binary size by about 12MB IIRC.

I have also tried to address some issues with our current Helm templating of the metrics server:

- allow enabling the secure mode with TLS+auth while not forcing users to have Promotheus installed e.g. when using Elastic Agent (!) (service monitor is still generated by default for bwc)
-    mixing configuration properties for the service monitor with the configuration properties of the metrics server (I moved them to serviceMonitor.* while implementing a form of bwc layer in the template

---------

Co-authored-by: Michael Montgomery <mmontg1@gmail.com>
Co-authored-by: Michael Morello <michael.morello@elastic.co>
(cherry picked from commit 032bff5)

# Conflicts:
#	go.sum
@pebrc
Copy link
Collaborator Author

pebrc commented Dec 11, 2024

💚 All backports created successfully

Status Branch Result
2.16

Questions ?

Please refer to the Backport tool documentation

thbkrkr pushed a commit that referenced this pull request Dec 11, 2024
This removes the kube-auth-proxy from the ECK Helm charts and the ECK documentation. Instead if follows the recommendation from controller-runtime to use the built-in FilterProvider filters.WithAuthenticationAndAuthorization.

This pulls in a bunch of k8s API server dependencies increasing the binary size by about 12MB IIRC.

I have also tried to address some issues with our current Helm templating of the metrics server:

- allow enabling the secure mode with TLS+auth while not forcing users to have Promotheus installed e.g. when using Elastic Agent (!) (service monitor is still generated by default for bwc)
-    mixing configuration properties for the service monitor with the configuration properties of the metrics server (I moved them to serviceMonitor.* while implementing a form of bwc layer in the template

---------

Co-authored-by: Michael Montgomery <mmontg1@gmail.com>
Co-authored-by: Michael Morello <michael.morello@elastic.co>
(cherry picked from commit 032bff5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v2.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

⚠️ Action Required: Replace Deprecated gcr.io/kubebuilder/kube-rbac-proxy
4 participants